package gui;

import java.awt.GridLayout;

import javax.swing.JPanel;

import application.Puzzle;


public class PuzzlePanel extends JPanel {

	private MainPanel mainPanel;
	private Puzzle puzzle;
	
	
	public PuzzlePanel(MainPanel mainPanel, Puzzle puzzle) {
		this.mainPanel = mainPanel;
		
		setLayout(new GridLayout(Puzzle.NUM_OF_ROW, Puzzle.NUM_OF_COL));
		setPuzzle(puzzle);
	}
	
	
	public void setPuzzle(Puzzle puzzle) {
		removeAll();
		
		this.puzzle = puzzle;
		
		for(int i = 0; i < Puzzle.NUM_OF_ROW; i++)
			for(int j = 0; j < Puzzle.NUM_OF_COL; j++)
				add(new PieceButton(mainPanel, puzzle.getPiece(i, j)));
	}
	
	// public void setGuessed(String keyword, boolean isGuessed) {}

}
